Xbasic

SQL::ConnectionGetPreferredSyntax Method

Syntax

Syntax as C = GetPreferredSyntax(ServerName as C, DataSource as C = "")

Arguments

ServerNameCharacter

The name of the server hosting the database.

DataSourceCharacter

Default = ""

Returns

SyntaxCharacter

The name of a syntax.

Description

Return a the most appropriate syntax for the server specified or an empty string if not known.

Discussion

When using the ODBC API, the data source name may not be sufficient to determine the appropriate syntax. The GetPreferredSyntax() method finds the driver name and scans it for a string close to an available syntax name. If no syntax matches, an empty string is returned. All drivers that support a single syntax will return that name.

Example

dim conn as SQL::Connection
dim connString as C
connString = "{A5API='Access', FileName='c:\program files\a5v8\mdbfiles\alphasports.mdb'}"
if .not. conn.open(connString)
    ui_msg_box("Error", conn.CallResult.text)
    end
end if
ui_msg_box("Preferred Syntax", conn.GetPreferredSyntax("localhost"))
conn.close()

See Also